package com.hfh.map;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesDemo {
    /*
    Properties 一般用于读取配置文件
     */
    @Test
    public void test1() throws Exception {
        Properties pros = new Properties();
        InputStream is = new FileInputStream("src/com/hfh/map/jdbc.properties");
        pros.load(is);// 加载配置文件
        pros.setProperty("name", "zs");
        System.out.println(pros.getProperty("name"));

        // 读取配置文件的值
        String username = pros.getProperty("username");
        String password = pros.getProperty("password");
        String driver = pros.getProperty("driver.class");
        System.out.println(username);
        System.out.println(password);
        System.out.println(driver);
    }


}
